package ui;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.*;

public class Ventana {
	private PanelTable pnlTable;
	private MenuEditorial menuEditorial;
	private MenuAutor menuAutor;
	private MenuTitulo menuTitulo;
		
	public MenuTitulo getMenuTitulo() {
		return menuTitulo;
	}

	public void setMenuTitulo(MenuTitulo menuTitulo) {
		this.menuTitulo = menuTitulo;
	}

	public MenuAutor getMenuAutor() {
		return menuAutor;
	}
	
	public void setMenuAutor(MenuAutor menuAutor) {
		this.menuAutor = menuAutor;
	}

	public MenuEditorial getMenuEditorial() {
		return menuEditorial;
	}

	public void setMenuEditorial(MenuEditorial menuEditorial) {
		this.menuEditorial = menuEditorial;
	}

	public PanelTable getPnlTable() {
		return pnlTable;
	}

	public void setPnlTable(PanelTable pnlEditorial) {
		this.pnlTable = pnlEditorial;
	}

	public void ini() {
        JFrame frame = new JFrame("ORM Demo");
        menuEditorial = new MenuEditorial(this);
        menuAutor = new MenuAutor(this);
        menuTitulo = new MenuTitulo(this);
        pnlTable = new PanelTable();
        pnlTable.setOpaque(true);
        
        JMenuBar mbar = new JMenuBar();
        mbar.add(menuEditorial);
        mbar.add(menuTitulo);
        mbar.add(menuAutor);
        frame.setJMenuBar(mbar);
        frame.setContentPane(pnlTable);

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setBounds(screenSize.width/4, screenSize.height/4, 
             		   screenSize.width/2, screenSize.height/2);
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        }); 
        frame.setVisible(true);
	}
}
